var GameDataManger = cc.Class({
    statics:{
       
        //音乐状态刷新
        musicRefresh:"musicRefresh",

        //提示
        showTip:"showTip",

        passTip:["不愧是人中翘楚！", "棋力高深的大手", "小小AI弹指破，天下无我这般人！"],

        //段位相关配置
        gradConfig:[{"id":9,"name":"至尊","score":1000,"icon":9},{"id":8,"name":"王者","score":700,"icon":8},{"id":7,"name":"星耀","score":500,"icon":7},{"id":6,"name":"钻石","score":400,"icon":6},{"id":5,"name":"铂金","score":300,"icon":5},{"id":4,"name":"黄金","score":200,"icon":4},{"id":3,"name":"白银","score":100,"icon":3},{"id":2,"name":"青铜","score":50,"icon":2},{"id":1,"name":"黑铁","score":0,"icon":1}],

        //AI关卡
        levelConfig:[{"id":1,"name":"初入棋境","cost":5,"icon":9},{"id":2,"name":"渐入佳境","cost":5,"icon":9},{"id":3,"name":"棋至巅峰","cost":5,"icon":9}],

        chatCoinfig:[{"id":101,"des":"小小棋艺弹指破，天下无我这般人!!"},{"id":102,"des":"快点啊，等得我对象都跑啦!"},{"id":103,"des":"犹豫不决的我，你猜不透。"},{"id":104,"des":"我的防守稳如泰山!"},{"id":105,"des":"只攻不防，赢了超酷耶!"},{"id":106,"des":"想赢我?去梦里想吧!"},{"id":107,"des":"哥哥，你好厉害呀·"},{"id":108,"des":"让让我吧~"}],

        musicVal: 1,        //音乐

        soundVal: 1,        //音效

        signDay: 0,          //签到时间

        signTime: 0,        //签到时间戳

        selfScore: 0,            //自己的积分

        selfGrade: 0,            //自己的段位id

        gold:500,               //当前货币

        curLevel:0,            //当前ai关卡 0是第一关未通过

        gameType: 1,            //游戏类型 1匹配，2ai, 3好友

        resultNum:1,            //游戏结果 1胜利，2失败，3平

        //加载图片
        loadIamge(image, url){
            //let url = 'imags/grades/' + iconName
            cc.resources.load(url, cc.SpriteFrame, (err, asset) => {
                if (err){
                    console.log("资源加载失败")
                    return;
                }
                image.getComponent(cc.Sprite).spriteFrame = asset;
            });
        },

        getGradeCfgById(id){
            for (let index = 0; index < GameDataManger.gradConfig.length; index++) {
                const element = GameDataManger.gradConfig[index];
                if (element.id == id){
                    return element;
                }
            }
            console.log("段位获取失败：" + id);
            return null;
        },

        //获取语言
        getChatCfgById(id){
            for (let index = 0; index < GameDataManger.chatCoinfig.length; index++) {
                const element = GameDataManger.chatCoinfig[index];
                if (element.id == id){
                    return element;
                }
            }
            console.log("段位获取失败：" + id);
            return null;
        },

    },
})

module.exports = GameDataManger
